﻿@{
    ViewBag.Title = "MpEdit";
    Layout = "~/Views/Shared/_adminLayout.cshtml";
}
@model MP_Setting

<h2>公众号修改</h2>
<div>
    @Html.ActionLink("返回列表", "MpList", null, new { Class = "btn btn-default" })
</div>
<hr />
<div style="max-width:800px;">
    @using (Html.BeginForm("MpEdit", "MpAdmin", FormMethod.Post, new { id = "form1", Class = "from", onsubmit = "return checkInput();", enctype = "multipart/form-data" }))
    {
        <input type="hidden" name="Id" value="@Model.Id" />
        <input type="hidden" name="Logo" value="@Model.Logo">

        <div class="form-group">
            <label>公众号名称</label>
            <input type="text" class="form-control" name="MpName" value="@Model.MpName" data-rule-required='true' data-msg-required="请输入公众号名称">
        </div>
        <div class="form-group">
            <label>AppId</label>
            <input type="text" class="form-control" name="AppId" value="@Model.AppId" data-rule-required='true' data-msg-required="请输入AppId">
        </div>
        <div class="form-group">
            <label>AppSecrect</label>
            <input type="text" class="form-control" name="AppSecrect" value="@Model.AppSecrect" data-rule-required='true' data-msg-required="请输入AppSecrect">
        </div>
        <div class="form-group">
            <label>登录名</label>
            <input type="text" class="form-control" name="LoginName" value="@Model.LoginName">
        </div>
        <div class="form-group">
            <label>密码</label>
            <input type="text" class="form-control" name="LoginPwd" value="@Model.LoginPwd">
        </div>     
        <div class="checkbox">
            <label>
                @if (Model.RefreshEnable)
                {
                    <input name="RefreshEnable" value="true" type="checkbox" checked="checked">
                }
                else
                {
                    <input name="RefreshEnable" value="true" type="checkbox">
                }
                自动更新
            </label>
        </div>
        <div class="form-group">
            <label>AccessToken</label>
            <input type="text" class="form-control" name="AccessToken" value="@Model.AccessToken">
        </div>
        <div class="form-group">
            <label>JsapiTicket</label>
            <input type="text" class="form-control" name="JsapiTicket" value="@Model.JsapiTicket">
        </div>
        <div class="form-group">
            <label>JsapiTicketWxCard</label>
            <input type="text" class="form-control" name="LoginPwd" value="@Model.JsapiTicketWxCard">
        </div>
        <div class="form-group">
            <label>RefreshInterval</label>
            <input type="text" class="form-control" name="RefreshInterval" value="@Model.RefreshInterval">
        </div>
        <div class="form-group">
            <label>LastRefreshTime</label>
            <input type="text" class="form-control" name="RefreshInterval" value="@Model.LastRefreshTime">
        </div>
        <div class="form-group">
            <label>Logo</label>
            <input type="file" name="thumbnail" />
            @if (!string.IsNullOrEmpty(Model.Logo))
            {
                <img style="max-height:220px;" src="@Url.Content("~/Content/images/article/" + Model.Logo)" />
            }
        </div>
        <button type="submit" class="btn btn-primary">提交</button>
    }
</div>

@section Scripts {
    <script src="~/scripts/jquery.validate.min.js"></script>
    <script src="~/scripts/jquery.form.js"></script>
    <script>
        $(function () {
            validateCN();
        })
        function validateCN() {
            $("form").validate({
                errorClass: "text-danger text-sm",
                errorPlacement: function (error, element) {
                    element.after(error);
                }
            });
        }
        function checkInput() {
            return $("#form1").valid();
        }
    </script>
}
